package com.example.demo.core;


import org.springframework.util.DigestUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MD5Util {
    private static final String key="Mawangdan";
    public static String md5(String text) {
        //加密后的字符串
        String encodeStr= DigestUtils.md5DigestAsHex((text + key).getBytes());
        return encodeStr;
        }

    /**
     * test md
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(        md5(DigestUtils.md5DigestAsHex("123456".getBytes())));//603e8d92bc0b7cd6b82e7735a60df34d
        System.out.println(        md5("123ad4ffffffffffffffffff啊56789"));
        SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSS'Z'");
        Date date=new Date(System.currentTimeMillis());
        System.out.println(formatter.format(date));
    }
}
